﻿using SFML.Graphics;
using SFML.Window;

namespace SFMLPlatformerEngine {

	class Map {

		public string[] tileMap;
		public int width, height;
		public int tileSize;
		public int offsetX, offsetY;
		public int deathLine;
		public RectangleShape tile;
		public GameObjectDictionary objects = new GameObjectDictionary();

		public Map(Texture texture, string[] tileMap, int tileSize) {
			tile = new RectangleShape(new Vector2f(tileSize, tileSize)) { Texture = texture };
			this.tileSize = tileSize;
			LoadTileMap(tileMap);
		}

		public Map(Texture texture, string[] tileMap) : this(texture, tileMap, 32) { }

		public Map(Texture texture) : this(texture, null) { }


		public void LoadTileMap(string[] tileMap) {
			if(tileMap == null)
				return;
			LoadTileMap(tileMap, tileMap[0].Length, tileMap.Length);
		}

		public void LoadTileMap(string[] tileMap, int width, int height) {
			if(tileMap == null)
				return;
			this.tileMap = tileMap;
			this.width = width;
			this.height = height;
			deathLine = tileMap.Length * 32 + 100;
		}
	}
}
